a = 'abcabcabc'
b = ''
c = 's'
def replaceAll(target,old,new):
    tl = len(target)
    ol = len(old)
    # nl = len(new)
    if not ol:
        return target
    for i in range(tl - ol + 1):
        if target[i:i+ol] == old:
            target = target[:i] + new + target[i+ol:]
    return target
d = replaceAll(a,b,c)
print(d)